package Day5.ZuoYe;

import java.text.SimpleDateFormat;
import java.util.Calendar;

//7：学士后月考是每月的第一个周六，输出今年的月考时间
public class ZuoYe7 {
    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();
        SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
        c.set(2022, 0, 1);
        for (int i = 0; i < 12; i++) {
            for (int j = 0, count = 0; j < c.get(Calendar.DAY_OF_MONTH); j++) {
                if (c.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY && count++ == 0) {
                    String s = sim.format(c.getTime());
                    System.out.println("今年的第" + (i + 1) + "次月考时间" + s);
                }
                c.add(Calendar.DAY_OF_MONTH, 1);
            }
        }
    }
}
